package com.zhang.zhangapp.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.zhang.zhangapp.base.config.HttpConfig;


/**
 * Created by LX on 2017/7/23.
 */
public class MenuItem implements Parcelable {



    private String id;
    private String pId;
    private String sort;
    private String name;
    private String image;



    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getpId() {
        return pId;
    }

    public void setpId(String pId) {
        this.pId = pId;
    }

    public String getSort() {
        return sort;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getImage() {
        return image;
    }

    public String getNormalImage() {
        if (image != null)
            return HttpConfig.IMAGE_HTTP_PATH+image.replace("@xx", "@1x");
        return "";
    }

    public String getDownImage() {
        if (image != null)
            return HttpConfig.IMAGE_HTTP_PATH+image.replace("@xx", "@1x").replace(".", "c.");
        return "";
    }

    public void setImage(String image) {
        this.image = image;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.pId);
        dest.writeString(this.sort);
        dest.writeString(this.name);
        dest.writeString(this.image);
    }

    public MenuItem() {
    }

    protected MenuItem(Parcel in) {
        this.id = in.readString();
        this.pId = in.readString();
        this.sort = in.readString();
        this.name = in.readString();
        this.image = in.readString();
    }

    public static final Creator<MenuItem> CREATOR = new Creator<MenuItem>() {
        @Override
        public MenuItem createFromParcel(Parcel source) {
            return new MenuItem(source);
        }

        @Override
        public MenuItem[] newArray(int size) {
            return new MenuItem[size];
        }
    };
}
